#include"Condition.h"

Condition::Condition(Mutexion &mutex)
:_mutex(mutex){
    //error 这里忘记写了
    pthread_cond_init(&_cond,nullptr);
}
Condition::~Condition(){
    pthread_cond_destroy(&_cond);
    cout<<"~Condition"<<endl;}
void Condition::wait(){
    pthread_cond_wait(&_cond,_mutex.getMutex());
}
void Condition::notify(){
    pthread_cond_signal(&_cond);
}
void Condition::notifyAll(){
    pthread_cond_broadcast(&_cond);
}